#include<iostream>
#include<cstring>                                     
using namespace std;                                             
class Student                                                    
{                                                                
    private :                                                       
        int age;
        char *name;                                                     
    public :
        Student(int m,char *n);                                         
        Student();                                                     
        ~Student(){};                                                   
        void SetName(int m,char *n);                                    
        int Getage();                                                   
        char *Getname();
        void Input();                                                
};                                                               
Student::Student()                                               
{                                                                
	age=0;
    name="none";   
                                    
}                                                                
Student::Student(int m,char *n)                                  
{                                                                
	age=m;                                                        
	strcpy(name,n);                                                
}                                                                
void Student::SetName(int m,char *n)                             
{                                                                
	age=m;                                                          
	strcpy(name,n);                                                
}                                                                
int Student::Getage()                                            
{                                                                
	return age;                                                     
}                                                                
char* Student::Getname()                                         
{                                                                
	return name;                                                    
}                    
void Student::Input()
{
	char na[10];
	cin>>age;
	cin>>na;
	name=new char[strlen(na)+1];
	strcpy(name,na);
}
int main()                                                       
{	                                                               
	Student stu[3];                                                 
	for (int i=0;i<3;i++)                                           
	{   
		cout<<"请输入第"<<i+1<<"个学生的年龄和姓名"<<endl;                                                    
		stu[i].Input();                                        
	}                                                           
	for (int i=0;i<3;i++)                                           
	{   
	cout<<"学生年龄"<<"  "<<"学生姓名"<<endl;                                                            
	cout<<stu[i].Getage()<<"            "<<stu[i].Getname()<<endl;          
	}                                                   
	return 0;                                                       
}